﻿Public Class Splash

    Private WithEvents timer As Timer
    Private elapsedSecs As Integer
    Private timeToExecute As Integer

    Sub New(ByVal time As Integer)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.

        timer = New Timer()
        timer.Interval = 1000
        timeToExecute = time
    End Sub

    Private Sub Splash_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
        timer.Start()
    End Sub

    Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timer.Tick

        If Not (elapsedSecs = timeToExecute) Then
            elapsedSecs += 1
        Else
            timer.Stop()
            timer.Dispose()
            Me.Dispose()
        End If

    End Sub

    Private Sub Splash_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click
        Me.Dispose()
        Threading.Thread.Sleep(300)
    End Sub
End Class